package me.xiaoyan.java.spring.controller;

import me.xiaoyan.java.spring.po.Link;
import me.xiaoyan.java.spring.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

// 前台页面控制器
@Controller
public class HomeController {
//
    private LinkService linkService;

    @Autowired
    public void setLinkService(LinkService linkService) {
        this.linkService = linkService;
    }

    @RequestMapping("/home")
    public String home(Model model){
        List<Link> linkList = linkService.findList(12);
        model.addAttribute("listList",linkList);// 相当于将数据存放与request
        return "home";
    }
}
